package com.ioday01demo;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class TestNote {
    public static void main(String[] args) throws IOException {
        inputString();
    }
    public static void inputString() throws IOException {
        Scanner sc = new Scanner(System.in);
        FileOutputStream fos = new FileOutputStream("note.txt",true);
        while (true) {

            System.out.println("请输入要录入的文字");
            System.out.println("输入exit关闭程序");
            String inputString = sc.nextLine();
           String temp = inputString + "\r\n";
            if ("exit".equalsIgnoreCase(inputString)){
                fos.close();
                System.out.println("正在关闭程序");
                return;
            }
            byte[] date = temp.getBytes(StandardCharsets.UTF_8);
            fos.write(date);
            System.out.println("录入完成");


        }

    }
}
